package cn.virens.mybatis.mapper.cursor;

import org.apache.ibatis.annotations.Lang;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.cursor.Cursor;

import cn.virens.mybatis.mapper.example.Example;
import cn.virens.mybatis.mapper.example.mapper.ExampleProvider;
import io.mybatis.mapper.base.EntityProvider;
import io.mybatis.provider.Caching;

public interface CursorMapper<T> {

	/**
	 * 根据实体字段条件查询
	 *
	 * @param  entity 实体类
	 * @return        实体列表
	 */
	@Lang(Caching.class)
	@SelectProvider(type = EntityProvider.class, method = "select")
	Cursor<T> selectCursor(T entity);

	/**
	 * 根据 Example 条件查询
	 *
	 * @param  example 条件
	 * @return         实体列表
	 */
	@Lang(Caching.class)
	@SelectProvider(type = ExampleProvider.class, method = "selectByExample")
	Cursor<T> selectCursorByExample(Example example);
}
